Components

Components are objects that contain logic and functionality you can use for creating user interfaces. Kanzi provides a comprehensive set of component types with features for the most common user interaction. See User interface components.

To extend the existing components, you can create new components by using default component types and other objects. Custom components you create are shown in Kanzi Studio in the Library > Components.

When working with components, keep in mind that a component type, such as a Button, contains the logic and default settings for all the component instances, such as Forward and Back button object in a scene.

Component root object

Each component type has a root object that acts as the template for component instances instantiated from it. Properties and message handlers attached to the root are available in the instantiated components. The root can also have children that can have their own children, attached properties, and message handlers.

In Kanzi Studio, changes in component type affect all the instantiated components. You cannot access the component types in the application code. Component instances can override properties and message handlers of their component types with their own customized values. After overriding a property in a component instance, any changes made in the component type no longer affect that particular instance.

Component action messages

Component action messages are actions that the components support, such as Toggle Button: Switch State. You can invoke actions by sending the corresponding action message to a component. You can do this in an event handler that handles the Click message in a button that you set to dispatch Toggle Button: Switch State message to a toggle button using the routing target setting.

Component events

Components publish event messages when their state changes allowing other interested parties to react to them. Events can carry arguments that contain details about the event. The arguments of an event are defined by a set of property types. See User interface components.

Component instances

Component instances are objects that are instantiated from component types. These instances inherit all properties, event handlers, and children from the component type.

The properties of user component instances and their inherited children are locked by default and they get their values from the component type. To customize some of the property values, you can override the property values in instances using the override button in the Properties.

The component templates within component types are usually not visual. To visualize a component, a button for example, add a mesh node as a child of the button. After visualizing a button, button clicks are registered when the user clicks the mesh node.

See also

User interface components

Creating custom controls

Creating custom layouts